#include "heard.h"

int getparameter(char *key, char *value){
    FILE *file = fopen("config.ini", "r");
    while(1){
        char line[60];
        memset(line, 0, sizeof(line));
        char *ret = fgets(line, sizeof(line), file);
        if(ret == NULL){

            char buf[] = "没有要找的内容 \n";
            memcpy(value, buf, sizeof(buf));
            return -1;
        }
        char *line_key = strtok(line, "=");
        if (strcmp(key, line_key) == 0){
            char *line_value = strtok(NULL,"=");
            memcpy(value, line_value, strlen(line_value));
            return 0;
        }
    }
    return 0;
}
